#include "StdAfx.h"
#include "TestTeapot.h"
#include "../Direct3D9/BillboardSpriteComponent.h"

CTestTeapot::CTestTeapot(void)
	: m_vVelocity(0,0,0)
{
//	m_pVisibleComponent = new CMeshComponent();
	m_pVisibleComponent = new CBillboardSpriteComponent();
	m_vPosition = D3DXVECTOR3( 400, 20, 0 );
}

CTestTeapot::~CTestTeapot(void)
{
}

void CTestTeapot::Tick( float fDeltaTime ) {	

	testKeyFunc();
	m_vPosition += m_vVelocity*fDeltaTime;

//	m_rRotation.Pitch += fDeltaTime*90;
//	m_rRotation.Yaw += fDeltaTime*90;
}

void CTestTeapot::testKeyFunc() {
	
	if ( GetAsyncKeyState( 'W' ) & 0x8000 ) {
		m_vVelocity.y = 100;
	}
	else if ( GetAsyncKeyState( 'S' ) & 0x8000 ) {
		m_vVelocity.y = -100;
	}
	else {
		m_vVelocity.y = 0;
	}

	if ( GetAsyncKeyState( 'D' ) & 0x8000 ) {
		m_vVelocity.x = 100;
	}
	else if ( GetAsyncKeyState( 'A' ) & 0x8000 ) {
		m_vVelocity.x = -100;
	}
	else {
		m_vVelocity.x = 0;
	}
}